# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=kio-fuse
pkgver=5.0.1
pkgrel=2
# armhf blocked by extra-cmake-modules
# s390x and riscv64 blocked by polkit -> kio
arch="all !armhf !s390x !riscv64"
url="https://kde.org/"
pkgdesc="FUSE interface for KIO"
license="GPL-3.0-only"
makedepends="
	extra-cmake-modules
	fuse3-dev
	kcoreaddons-dev
	kdbusaddons-dev
	kio-dev
	qt5-qtbase-dev
	samurai
	"
checkdepends="dbus"
source="https://download.kde.org/stable/kio-fuse/$pkgver/kio-fuse-$pkgver.tar.xz
	modules-load.conf
	kio-fuse.desktop
	"
install="$pkgname.post-install"
options="!check" # Only test is broken

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 "$srcdir"/modules-load.conf "$pkgdir"/usr/lib/modules-load.d/kio-fuse.conf
	install -Dm644 "$srcdir"/kio-fuse.desktop -t "$pkgdir"/etc/xdg/autostart/

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/tmpfiles.d
	rm -r "$pkgdir"/usr/lib/systemd
}

sha512sums="6423c461c001bb27d4e17e6f9a69e4a28c2e7834b6702bd14e4b34db9fc3156cdbb5400ec2c3f15975e78e563abbf14412f8f1b1db05f6313a8520bab030e7bd  kio-fuse-5.0.1.tar.xz
57d23d2778556eafc3035e6be575bf95b4032f123b35f2b1657eff5e7496de253173edc657f90531ee58e25673f4f27a5cd1cc76b14a038edb244f104a231771  modules-load.conf
94a5acc6d6b622f923e6fa077cac63f365ad1a0828690336421368f7300179b39318b10c5e6490de7c442e2713dc25b2b3fb17fee4ac4064595a474ea50c2137  kio-fuse.desktop"
